package hermesV2.services.HubService;

import hermesV2.agent.AbstractProtocol;
import hermesV2.agent.Interaction;


public class HubServiceProtocol extends AbstractProtocol {
   public static final String REQUEST = "REQUEST";

   public static final String RESPONSE = "RESPONSE";

   public static final String ERROR = "ERROR";

   public static final String INVOKE = "INVOKE";

   public static final String INTERACTION1REQUEST = "AckIP";
   public static final String INTERACTION1RESPONSE = "ResponseAckIP";
   public static final String INTERACTION1ERROR = "ErrorAckIP";

   public static final String INTERACTION1REQUEST2  = "RequestSendEmailWithAttachment";
   public static final String INTERACTION1RESPONSE2 = "ResponseSendEmailWithAttachment";
   public static final String INTERACTION1ERROR2    = "ErrorSendEmailWithAttachment";

   public HubServiceProtocol() {
       super("HubServiceProtocol");

       String[] parameterNameInteraction1Request = new String[2];
       parameterNameInteraction1Request[0] = "PeerIP";
       parameterNameInteraction1Request[1] = "PeerPort";
       
       Class[] parameterTypeInteraction1Request = new Class[2];
       parameterTypeInteraction1Request[0] = String.class;
       parameterTypeInteraction1Request[1] = String.class;

       Interaction ackIP = new Interaction(INTERACTION1REQUEST,
               "AckIP", REQUEST,
               parameterNameInteraction1Request,
               parameterTypeInteraction1Request);
       addInteraction(ackIP);


       String[] parameterNameInteraction1Response = new String[1];
       parameterNameInteraction1Response[0] = "Response";
       Class[] parameterTypeInteraction1Response = new Class[1];
       parameterTypeInteraction1Response[0] = String.class;
       Interaction responseAckIP = new Interaction(INTERACTION1RESPONSE,
               "ResponseAckIP",RESPONSE,
               parameterNameInteraction1Response,
               parameterTypeInteraction1Response);
       addInteraction(responseAckIP);
       addResponseLink(ackIP,responseAckIP);

       //Error Dynamic Call Protocol Parameter
       String[] parameterNameInteraction1Error = new String[1];
       parameterNameInteraction1Error[0] = "Error";
       Class[] parameterTypeInteraction1Error = new Class[1];
       parameterTypeInteraction1Error[0] = String.class;

       Interaction errorAckIP = new Interaction(INTERACTION1ERROR,"ErrorAckIP",ERROR,parameterNameInteraction1Error,parameterTypeInteraction1Error);

       addInteraction(errorAckIP);
       addErrorLink(ackIP,errorAckIP);


   }
}